package historymanager.servlets;

import historymanager.tools.CsvUpdate;
import historymanager.tools.MeasureCompressor;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.log4j.Logger;

/**
 * Listener-Class to influence startup- and shutdown-procedure of the
 * webb-application
 * 
 * @author Thomas Aulich
 * @version 1.0
 *
 */
public class HistoryManagerServletContextListener implements
		ServletContextListener {

	static Logger log = Logger
			.getLogger(HistoryManagerServletContextListener.class);

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		log.debug("contextDestroyed() was called");
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		log.debug("contextInitialized() was called");
		CsvUpdate CsvUpdate = new CsvUpdate();
		Thread thread = new Thread(CsvUpdate);
		thread.start();
		MeasureCompressor measureCompressor = new MeasureCompressor();
		Thread anotherThread = new Thread(measureCompressor);
		anotherThread.start();
	}

}
